/*
 *@Author: 张楚
 *@Date: 2021-08-02 20:49:24
 *@Description: 日常练习模块
*/

import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:totaldemo/config/init_config.dart';
import 'package:totaldemo/pages/ListView_disPlay.dart';
import 'package:totaldemo/pages/bottom_sheet.dart';
import 'package:totaldemo/pages/clickSubItem.dart';
import 'package:totaldemo/practice/DateRangPage.dart';
import 'package:totaldemo/practice/GridViewPage.dart';
import 'package:totaldemo/practice/List_practice.dart';
import 'package:totaldemo/practice/chooseImage.dart';
import 'package:totaldemo/practice/chooseImage_two.dart';
import 'package:totaldemo/practice/cut_Pictures.dart';
import 'package:totaldemo/practice/date_choose.dart';
import 'package:totaldemo/practice/dropDown_one.dart';
import 'package:totaldemo/practice/dropDown_two.dart';
import 'package:totaldemo/practice/dropDownbutton.dart';
import 'package:totaldemo/practice/dropdown_2.dart';
import 'package:totaldemo/practice/dropdown_search.dart';
import 'package:totaldemo/practice/open_close.dart';
import 'package:totaldemo/practice/overlay_p.dart';
import 'package:totaldemo/practice/overlay_practice.dart';
import 'package:totaldemo/practice/pick_three.dart';
import 'package:totaldemo/practice/progress.dart';
import 'package:totaldemo/practice/save_img.dart';
import 'package:totaldemo/practice/save_img_two.dart';
import 'package:totaldemo/practice/scan_three.dart';
import 'package:totaldemo/practice/seekBar.dart';
import 'package:totaldemo/practice/seekbar2.dart';
import 'package:totaldemo/practice/shake.dart';
import 'package:totaldemo/practice/smartDemo/smartDialog.dart';
import 'package:totaldemo/practice/tabBar.dart';
import 'package:totaldemo/practice/table_calendar.dart';
import 'package:totaldemo/practice/textField.dart';
import 'package:totaldemo/practice/textField_1.dart';
import '../utils/screen_unit.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class PracticePage extends StatefulWidget {
  const PracticePage({Key key}) : super(key: key);

  @override
  _PracticePageState createState() => _PracticePageState();
}

class _PracticePageState extends State<PracticePage> {
  List<MenuBean> menuList = [];
  @override
  void initState() {
    super.initState();
    _initMenu();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text('小demo练习啦'),
        ),
        body: ListView(children: [
          Wrap(
            // mainAxisAlignment: MainAxisAlignment.start,
            direction: Axis.horizontal,
            spacing: 10.w,
            runSpacing: 10.w,
            children: List.generate(
                menuList.length,
                (index) => ElevatedButton(
                      onPressed: () {
                        Get.to(() => menuList[index].page);
                      },
                      child: Text(menuList[index].title),
                    )),
          )
        ]));
  }

  void _initMenu() {
    menuList.add(MenuBean(title: '封装底部组件页面', page: BottomSheetPage()));
    menuList.add(MenuBean(title: '点击留言输入框获取焦点', page: CommentTest()));
    menuList.add(MenuBean(title: 'listView动态显示内容', page: ListDisplay()));
    menuList.add(MenuBean(title: '点击增加一个item', page: ClickSubIiemPage()));
    menuList.add(MenuBean(title: '拖动条', page: Home()));
    menuList.add(MenuBean(title: '拖动条2', page: SeekBarPageTwo()));
    menuList.add(MenuBean(title: 'TabBar', page: TabBarPage()));
    menuList.add(MenuBean(title: '摇一摇', page: ShakePage()));
    menuList.add(MenuBean(title: 'textfieid--demo', page: TextFieldDemo()));
    menuList.add(MenuBean(title: 'List的专项练习--demo', page: PracticeListPage()));
    menuList.add(MenuBean(title: '下拉菜单', page: Dropdown(title: '111')));
    menuList.add(MenuBean(title: '下拉菜单2', page: DropDownPage()));
    menuList.add(MenuBean(title: '下拉菜单3', page: GZXDropDownMenuTestPage()));
    menuList.add(MenuBean(title: '下拉菜单4', page: DropDownPageTwo()));
    menuList.add(MenuBean(title: 'dropbutton', page: DropDownButtonPage()));
    menuList.add(MenuBean(title: '展开收起', page: ColoseOpenPage()));
    menuList.add(MenuBean(title: '扫一扫', page: ColoseOpenPage()));
    menuList.add(MenuBean(title: '日历', page: TableCalendarPage()));
    menuList.add(MenuBean(title: '保存图片', page: SaveImgPage()));
    // menuList.add(MenuBean(title: '保存图片2', page: ScanTreePage()));
    menuList.add(MenuBean(title: '日期选择', page: DateChoosePage()));
    menuList.add(MenuBean(title: '选择图片', page: ImagePickerPage()));
    menuList.add(MenuBean(title: '时间范围选择器', page: DateRangPage()));
    menuList.add(MenuBean(title: 'Overlay练习', page: OverlayPage()));
    menuList.add(MenuBean(title: '滑动滚动', page: GridViewPage()));

    menuList.add(MenuBean(title: '强大的dialog', page: SmartDialogPage()));
    menuList.add(MenuBean(title: '手写进度条', page: AppProgress()));
  }
}
